package com.gws.ievent.service.job;

import com.gws.ievent.common.utils.DateTimeUtil;
import com.gws.ievent.scheduler.Scheduler;
import com.gws.ievent.scheduler.IJob;

/**
 * @author song
 * @date 2022/10/20 22:52
 */
public class SleepJob implements IJob {

    private final int second;
    private final String text;

    public SleepJob(int second, String text) {
        this.second = second;
        this.text = text;
    }

    /**
     * 执行方法
     *
     * @return
     */
    @Override
    public void run(Scheduler event) {
        try {
            Thread.sleep(this.second * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("SleepJob " + DateTimeUtil.now() + " " + this.text);
    }
}
